<
programming> (Either
shift left
logical or
shift right
logical) Machine-level operations available on nearly all
processors which move each bit in a word one or more bit
positions in the given direction. A left
shift moves the bits
to more significant positions (like multiplying by two), a
right
shift moves them to less significant positions (like
dividing by two). The comparison with multiplication and
division breaks down in certain circumstances - a
logical
shift may discard bits that are shifted off either end of the
word and does not preserve the sign of the word (positive or
negative).
Logical shift is approriate when treating the word as a {bit
string} or a sequence of
bit fields, whereas {arithmetic
shift} is appropriate when treating it as a binary number.
The word to be shifted is usually stored in a
register, or
possibly in memory.
(1996-07-02)